home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
batuti.arc
/
SETNIC.C
< prev
next >
Wrap
Text File
|
1990-01-10
|
2KB
|
59 lines
/*
*
* setnic -- sets the environment variable name in arg[1] to the Current
* Working Directory
* Richard Connelly,(C) 1989,1990
*
*/
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <mem.h>
#include <process.h>
#include <string.h>
#include "mst_env.h"
#include "anw.h"
void main(int argc, char *argv[])
{
/*
* Determine if the user is using the command correctly
*/
int station;
CONNECTINFO who;
if (argc == 1)
{
fprintf(stderr," usage:\n\t setnic env-name \n");
exit(-1);
}
/*
* Determine if the user is logged into the server
*/
station=GetConnectionNumber();
who=GetConnectInfo(station);
if (!strlen(who.objectname))
{
fprintf(stderr,"Setuser v1.0\n");
fprintf(stderr,"\n\n\tYou have not logged into an Advanced Netware Server.\n");
fprintf(stderr,"\tLogin to the server an execute the command again or \n");
fprintf(stderr,"\tcontact the network system administrator for assistance. \n\n");
fprintf(stderr,"\t<< Press Any Key to Continue >>");
getch();
fprintf(stderr,"\n");
exit(-1); /* terminate with a failure code */
}
/*
* Set the cwd to an environment variable provided via argv
*/
/* set the environment var passed */
if (m_putenv(argv[1],strupr(GetStationAddress())))
fprintf(stderr,"Out of environment space\n");
exit(0); /* by argv & terminate successfully*/
}